package com.tiancheng.trade.merchant.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.tiancheng.trade.merchant.util.UserUtils;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
public class BaseModel implements Serializable {

    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    private String createdBy;

    private LocalDateTime createdDt;

    private String lastUpdBy;

    private LocalDateTime lastUpdDt;

    private Integer isDelete;

    /**
     * 填充创建人
     */
    public void injectionCreatedBy() {
        this.createdBy = UserUtils.currentUserId();
    }

    /**
     * 填充更新人
     */
    public void injectionLastUpdBy() {
        this.lastUpdBy = UserUtils.currentUserId();
    }
}
